package executeEngine.localVariable;

public class Demo1 {

    final static int size = 32 * 1024 * 1024;

    static void test1() {
        System.out.println("------------ test1 -------------------");
        byte[] bytes = new byte[size];
        System.gc();
        System.out.println("\n");
    }

    static void test2() {
        System.out.println("------------ test2 -------------------");
        {
            byte[] bytes = new byte[size];
//            bytes = null;
        }
        System.gc();
        System.out.println("\n");
    }

    static void test3() {
        System.out.println("------------ test3 -------------------");
        {
            byte[] bytes = new byte[size];
        }
        int a = 0;
        System.gc();
        System.out.println("\n");
    }

    static void test4() {
        System.out.println("------------ test4 -------------------");
        byte[] bytes = new byte[size];
        int a = Integer.MAX_VALUE;
        System.gc();
        System.out.println("\n");
    }

    public static void main(String[] args) {
//        test1();
//        test2();
//        test3();
        test4();
    }
}
